<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arrayLike = {
            '0': 'a',
            '3': 'b',
            '2': 'c',
            name:'wangzhi',
            length: 7,
        };
        // Array.from在遍历的时候会按照索引的升序来提取值，但只提取哪些实际存在于对象中的索引对应的值
        // 所以输出结果是下面的
        let arr2 = Array.from(arrayLike); 
        console.log(arr2)// ['a', undefined, 'c', 'b', undefined, undefined, undefined]
        console.log(arr2.length); // 7
        
    </script>
</body>
</html>